package com.wxg.md;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import org.markdownj.MarkdownProcessor;

/**
 * "markdownj"不靠谱啊!
 * "###"并不能翻译为HTML标记
 * 
 * @author pactera-wxg
 *
 */
public class HelloMarkdownj {

	public static void main(String[] args) {
		MarkdownProcessor mdprocessor = new MarkdownProcessor();
		String html = mdprocessor.markdown("*italic*   **bold**\n_italic_   __bold__");
		System.out.println( html );
		// 
		StringBuilder sbb = new StringBuilder();
		BufferedReader br = null;
		String path = "F:\\wxg2\\mygitbooks\\wow\\README.md";
		try {
			br = new BufferedReader(new FileReader(new File(path)));
			String line = null;
			while( (line=br.readLine()) != null ){
				sbb.append( line );
			}
			br.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println("======");
		String content = sbb.toString();
		System.out.println( content );
		System.out.println("======");
		System.out.println( mdprocessor.markdown( content ));
	}
}
